<?php

namespace app\admin\model;

use app\common\dict\site\SiteAppTypeDict;
use think\Model;

/**
 * AdminRule 模型
 */
class AdminRule extends Model
{
    protected $autoWriteTimestamp = true;

    public function setComponentAttr($value)
    {
        if ($value) $value = str_replace('\\', '/', $value);
        return $value;
    }



    public function setTitleAttr($value, $data)
    {
        if(!array_key_exists('app_type', $data)){
            $this->set('app_type',SiteAppTypeDict::SUPER_ADMIN);
        }
        return $value;
    }



}